﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace BRMC.IntelligentCommunity.Migrations
{
    public partial class up_UserParkinginfo : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_CarInfos_UserParkinginfos_UserParkinginfoId",
                table: "CarInfos");

            migrationBuilder.DropIndex(
                name: "IX_CarInfos_UserParkinginfoId",
                table: "CarInfos");

            migrationBuilder.DropColumn(
                name: "UserParkinginfoId",
                table: "CarInfos");

            migrationBuilder.AddColumn<string>(
                name: "Cars",
                table: "UserParkinginfos",
                nullable: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Cars",
                table: "UserParkinginfos");

            migrationBuilder.AddColumn<long>(
                name: "UserParkinginfoId",
                table: "CarInfos",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_CarInfos_UserParkinginfoId",
                table: "CarInfos",
                column: "UserParkinginfoId");

            migrationBuilder.AddForeignKey(
                name: "FK_CarInfos_UserParkinginfos_UserParkinginfoId",
                table: "CarInfos",
                column: "UserParkinginfoId",
                principalTable: "UserParkinginfos",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
